import {createStore} from 'vuex'

export default createStore({
    state: {
        // token: localStorage.getItem("token"),
        globalPost: {
            tags: "tag"
        }
    },
    getters: {
        getToken: () => () => {
            return localStorage.getItem("token");
        },
        getGlobalPost: (state)  =>{
            return state.globalPost;
        }
    },
    mutations: {
        login(state, token) {
            state.token = token;
        },
        logout(state) {
            state.token = "";
        },
        GLOBAL_POST(state,post){
            state.globalPost = post;
        }
    },
    actions: {},
    modules: {}
})
